﻿
Imports extremo
Public Class ReservaForm



    Private Sub btnNuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNuevo.Click

        Dim form As New RReserva
        form.MdiParent = Me.MdiParent
        form.ReservaForm = Me
        form.Show()


    End Sub




    Private Sub btnSalir_Click(sender As System.Object, e As System.EventArgs) Handles btnSalir.Click
        Me.Close()
    End Sub

    

    Private Sub btnBuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscar.Click
        Dim criterio As String = Me.txtBuscar.Text
        'MsgBox(criterio)

        Dim negocio As New ReservaNegocio
        Dim categorias As Collection = negocio.buscarPorFecha_reserva(criterio)
        Me.dgvReservas.DataSource = categorias
        Me.dgvReservas.EditMode = False

        Me.dgvReservas.Columns(0).HeaderText = "Idreserva"
        Me.dgvReservas.Columns(1).HeaderText = "IDevento"
        Me.dgvReservas.Columns(2).HeaderText = "IDusuario"
        Me.dgvReservas.Columns(3).HeaderText = "Fecha_reserva"
        Me.dgvReservas.Columns(4).HeaderText = "Deporte"
        Me.dgvReservas.Columns(5).HeaderText = "Cantidad"

    End Sub
    Private Sub txtBuscar_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBuscar.TextChanged

    End Sub

    Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEliminar.Click

        Dim seleccionado = Me.dgvReservas.CurrentRow.Cells(0).Value.ToString
        Dim negocio As New ReservaNegocio
        negocio.eliminar(seleccionado)
        dgvReservas.DataSource = ""
        MsgBox("La Reserva ha sido eliminada!!!!")



    End Sub
End Class